package initialize

import (
	"fmt"
	"github.com/gomodule/redigo/redis"
	"news/global"
)

// RedisConnect redis连接
func RedisConnect() redis.Conn {
	c, err := redis.Dial("tcp", fmt.Sprintf("%s:%d", global.Config.RedisConfig.Host, global.Config.RedisConfig.Port))
	if err != nil {
		fmt.Println("conn redis failed,", err)
		return nil
	}
	c.Do("auth", global.Config.RedisConfig.Password)
	return c
}
